<template>
	<view class="page">
		<view class="pageBg">
			<image src="https://bjsx.gzwhir.com/admin-api/infra/file/18/get/memberbg2.jpg" mode="aspectFill"></image>
		</view>
		<view class="flex0">
			<u-navbar :fixed='false' bgColor="transparent" @leftClick="noHandler"  title="学生心理健康服务平台">
				<view slot="left"></view>
				<view slot="center" class="navTitle"></view>
			</u-navbar>
		</view>
		<view class="flex1">
			<scroll-view scroll-y="true" class="scrollView">
				<view class="pd30">
					<view class="memberHd">
						<view class="avantar">
							<image :src="personInfo.avatar" mode="aspectFill"></image>
						</view>
						<view class="minfo" v-if="isLogin">
							<view class="nick">
								<view class="n">
									{{personInfo.name||'未登录'}}
								</view>
								<view class="sex">
									<view class="ico" v-if="personInfo.sex=='男'">
										<image src="@/static/images/icon-male.svg" mode="aspectFit"></image>
									</view>
									<view class="ico" v-else>
										<image src="@/static/images/icon-female.svg" mode="aspectFit"></image>
									</view>
								</view>
							</view>
							<view class="pos" style="background: linear-gradient(90deg,#d6e5fc,#e8f2ff);">
								<view class="ico">
									<image src="@/static/images/icon-vip4.svg" mode="aspectFit"></image>
								</view>
								<view class="p" style="color: #6ba3ed;">
									{{personInfo.userTypeName}}
								</view>
							</view>
						</view>
						<view class="minfo" v-else @click="toLogin">
							<view class="tit">登录注册</view>
						</view>
						<view class="btn">
							<navigator url="/subpage/settings/settings" class="navigator" open-type="navigate">
								<image src="@/static/images/icon-setting.svg" mode="aspectFit"></image>
							</navigator>
						</view>
					</view>
					<view class="hMenus" v-if="personInfo.userType==3 && personInfo.secondaryUserType.indexOf('3')!=-1">
						<navigator url="/subpage/teacher/warningList/warningList" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/expert-m1.png" mode="heightFix"></image>
							</view>
							<view class="p">
								风险预警名单
							</view>
						</navigator>
						<navigator url="/subpage/teacher/intervene/intervene" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/expert-m2.png" mode="heightFix"></image>
							</view>
							<view class="p">
								危机干预
							</view>
						</navigator>
						<navigator url="/subpage/teacher/appointmentRecord/appointmentRecord" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/expert-m3.png" mode="heightFix"></image>
							</view>
							<view class="p">
								心理咨询记录
							</view>
						</navigator>
						<navigator url="/subpage/teacher/scheduling/scheduling" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/expert-m4.png" mode="heightFix"></image>
							</view>
							<view class="p">
								排班设置
							</view>
						</navigator>
					</view>
					<view class="vMenus" style="position: relative;">
						<view class="login-mask" v-if="!isLogin"  @click="toLogin"></view>
						<navigator url="/subpage/my/profile" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m1.png" mode="aspectFit"></image>
							</view>
							<view class="p">基本信息</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						<!-- <navigator url="/subpage/expert/scheduling/scheduling" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m2.png" mode="aspectFit"></image>
							</view>
							<view class="p">排班管理</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator> -->
						<navigator v-if="personInfo.userType!=1" url="/subpage/expert/archives/archives" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m3.png" mode="aspectFit"></image>
							</view>
							<view class="p">学生心理健康档案</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						<navigator url="/subpage/student/works/works" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m2.png" mode="aspectFit"></image>
							</view>
							<view class="p">系统任务</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						<navigator url="/subpage/my/myTest/myTest" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m6.png" mode="aspectFit"></image>
							</view>
							<view class="p">我的测评</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						<navigator v-if="personInfo.userType==1 || personInfo.userType==2" url="/subpage/expert/appointmentRecord/appointmentRecord" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m7.png" mode="aspectFit"></image>
							</view>
							<view class="p">心理咨询预约记录</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						
						<navigator url="/subpage/message/message" open-type="navigate" class="i navigator">
							<view class="ico">
								<image src="@/static/images/m5.png" mode="aspectFit"></image>
								<text class="dot" v-if="info.uread>0"></text>
							</view>
							<view class="p">消息通知</view>
							<view class="rico">
								<image src="@/static/images/icon-more.svg" mode="aspectFit"></image>
							</view>
						</navigator>
						
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="flex0">
			<TabBar :active="3" type="expert"></TabBar>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isLogin:false,
				personInfo:{}
			}
		},
		methods: {
			toAdd(){
				
					this.$api.crisisAdd({
						userId:'1874364871283253249',content:'4',level:3,score:42
					}, res => {
						if (res.code == 200) {
						}
					})
				
			},
			toLogin() {
				uni.navigateTo({
					url: '/subpage/login/login'
				})
			},
			getInfo(){
				
				
					
					if (this.$db.get("userToken")) {
						this.$api.memberInfo({}, res => {
							if (res.code == 200) {
								this.isLogin = true
								this.personInfo = res.data;
							}
						})
					
					}
			}
		},
		onShow(){
			this.getInfo();
		}
	}
</script>

<style lang="scss" scoped>
	
		.login-mask{
			position: absolute;
			top: 0;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 10;
		}
</style>
